#pragma warning disable 0618
using System;
using System.Collections.Generic;
using Table.DataModel;
namespace Table.Dao
{
    public class TableSceneInteractiveObjDao:DaoBase<TableSceneInteractiveObj>
    {
        public override string GetFileName()
        {
            return "TableSceneInteractiveObj.csv";
        }
        public override void BuildIndex()
        {
            if (cacheList != null)
            {
                cachePrimaryInt = new Dictionary<int, TableSceneInteractiveObj>(cacheList.Count);
            }
            base.BuildIndex();
        }
        public override void AddOneIndex(TableSceneInteractiveObj model)
        {
            if (!cacheOneIndex.ContainsKey(model.sceneId.ToString()))
            {
                cacheOneIndex[model.sceneId.ToString()] = new List<TableSceneInteractiveObj>();
            }
            cacheOneIndex[model.sceneId.ToString()].Add(model);
        }
        public override void AddPrimaryIndex(TableSceneInteractiveObj model)
        {
            #if UNITY_EDITOR
            if(cachePrimaryInt.ContainsKey(model.id)) UnityEngine.Debug.LogError("数据表id重复:TableSceneInteractiveObj->id: " + model.id);
            #endif
            cachePrimaryInt[model.id] = model;
        }
        protected override TableSceneInteractiveObj ParseRowData(string[] rowData)
        {
            TableSceneInteractiveObj data = new TableSceneInteractiveObj();
            if (!string.IsNullOrEmpty(rowData[0]))
            {
                data.id = int.Parse(rowData[0]);
            }
            if (!string.IsNullOrEmpty(rowData[1]))
            {
                data.sceneId = int.Parse(rowData[1]);
            }
            if (!string.IsNullOrEmpty(rowData[2]))
            {
                data.positionId = int.Parse(rowData[2]);
            }
            if (!string.IsNullOrEmpty(rowData[3]))
            {
                data.name = string.Intern(rowData[3]);
            }
            if (!string.IsNullOrEmpty(rowData[4]))
            {
                data.modelId = int.Parse(rowData[4]);
            }
            if (!string.IsNullOrEmpty(rowData[5]))
            {
                data.modelScale = double.Parse(rowData[5]);
            }
            if (!string.IsNullOrEmpty(rowData[6]))
            {
                data.openAniName = rowData[6];
            }
            if (!string.IsNullOrEmpty(rowData[7]))
            {
                data.effectId = int.Parse(rowData[7]);
            }
            if (!string.IsNullOrEmpty(rowData[8]))
            {
                data.openEffectId = int.Parse(rowData[8]);
            }
            if (!string.IsNullOrEmpty(rowData[9]))
            {
                data.radius = double.Parse(rowData[9]);
            }
            if (!string.IsNullOrEmpty(rowData[10]))
            {
                data.belongModule = int.Parse(rowData[10]);
            }
            if (!string.IsNullOrEmpty(rowData[11]))
            {
                data.type = int.Parse(rowData[11]);
            }
            if (!string.IsNullOrEmpty(rowData[12]))
            {
                data.requiredTaskTargetId = int.Parse(rowData[12]);
            }
            return data;
        }
    }
}
